package com.thinkgem.jeesite.modules.sys.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.thinkgem.jeesite.kpoint.core.base.KpointBaseEntity;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.util.Date;

;

/**
 * 用户信息变更记录Entity
 *
 * @author kongxiangsheng
 * @version 2018-09-30
 */
@Data
public class SysUserChangeLog extends KpointBaseEntity {
    public static final String COL_USER_ID = "`user_id`";
    public static final String COL_CHANGE_CODE = "`change_code`";
    public static final String COL_CHANGE_DESC = "`change_desc`";
    public static final String COL_COMPANY_ID = "`company_id`";
    public static final String COL_OFFICE_ID = "`office_id`";
    public static final String COL_ORG_ID = "`org_id`";
    public static final String COL_LOGIN_NAME = "`login_name`";
    public static final String COL_PASSWORD = "`password`";
    public static final String COL_NO = "`no`";
    public static final String COL_NAME = "`name`";
    public static final String COL_EMAIL = "`email`";
    public static final String COL_PHONE = "`phone`";
    public static final String COL_MOBILE = "`mobile`";
    public static final String COL_USER_TYPE = "`user_type`";
    public static final String COL_PHOTO = "`photo`";
    public static final String COL_LOGIN_IP = "`login_ip`";
    public static final String COL_LOGIN_DATE = "`login_date`";
    public static final String COL_LOGIN_FLAG = "`login_flag`";



    private static final long serialVersionUID = 1L;
    /**
     * user_id
     */
    @Length(min = 1, max = 64, message = "user_id长度必须介于 1 和 64 之间")
    private String userId;
    /**
     * 归属公司
     */
    @Length(min = 1, max = 64, message = "归属公司长度必须介于 1 和 64 之间")
    private String companyId;
    /**
     * 归属部门
     */
    @Length(min = 1, max = 64, message = "归属部门长度必须介于 1 和 64 之间")
    private String officeId;
    /**
     * 所属区域ID
     */
    @Length(min = 0, max = 64, message = "所属区域ID长度必须介于 0 和 64 之间")
    private String orgId;
    /**
     * 登录名
     */
    @Length(min = 1, max = 100, message = "登录名长度必须介于 1 和 100 之间")
    private String loginName;
    /**
     * 密码
     */
    @Length(min = 1, max = 100, message = "密码长度必须介于 1 和 100 之间")
    private String password;
    /**
     * 工号
     */
    @Length(min = 0, max = 100, message = "工号长度必须介于 0 和 100 之间")
    private String no;
    /**
     * 姓名
     */
    @TableField(condition = SqlCondition.LIKE)
    @Length(min = 1, max = 100, message = "姓名长度必须介于 1 和 100 之间")
    private String name;
    /**
     * 邮箱
     */
    @Length(min = 0, max = 200, message = "邮箱长度必须介于 0 和 200 之间")
    private String email;
    /**
     * 电话
     */
    @Length(min = 0, max = 200, message = "电话长度必须介于 0 和 200 之间")
    private String phone;
    /**
     * 手机
     */
    @Length(min = 0, max = 200, message = "手机长度必须介于 0 和 200 之间")
    private String mobile;
    /**
     * 用户类型
     */
    @Length(min = 0, max = 1, message = "用户类型长度必须介于 0 和 1 之间")
    private String userType;
    /**
     * 用户头像
     */
    @Length(min = 0, max = 1000, message = "用户头像长度必须介于 0 和 1000 之间")
    private String photo;
    /**
     * 最后登陆IP
     */
    @Length(min = 0, max = 100, message = "最后登陆IP长度必须介于 0 和 100 之间")
    private String loginIp;
    /**
     * 最后登陆时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date loginDate;
    /**
     * 是否可登录
     */
    @Length(min = 0, max = 64, message = "是否可登录长度必须介于 0 和 64 之间")
    private String loginFlag;

    /**
     * 构造方法
     */
    public SysUserChangeLog() {
    }

    /**
     * 构造方法
     *
     * @param sysUser
     */
    public SysUserChangeLog(SysUser sysUser) {
        this.setUserId(sysUser.getId());
        this.setCompanyId(sysUser.getCompanyId());
        this.setOfficeId(sysUser.getOfficeId());
        this.setLoginName(sysUser.getLoginName());
        this.setPassword(sysUser.getPassword());
        this.setNo(sysUser.getNo());
        this.setName(sysUser.getName());
        this.setEmail(sysUser.getEmail());
        this.setPhone(sysUser.getPhone());
        this.setMobile(sysUser.getMobile());
        this.setUserType(sysUser.getUserType());
        this.setPhoto(sysUser.getPhoto());
        this.setLoginIp(sysUser.getLoginIp());
        this.setLoginDate(sysUser.getLoginDate());
        this.setLoginFlag(sysUser.getLoginFlag());
    }
}